-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution
-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk.
local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
  -- stylua: ignore
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)

-- validate that lazy is available
if not pcall(require, "lazy") then
  -- stylua: ignore
  vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {})
  vim.fn.getchar()
  vim.cmd.quit()
end

if vim.g.vscode then
  require "utils.vsinit"
else
  require("lazy").setup({
    {
      "AstroNvim/AstroNvim",
      version = "^4", -- TODO: change `branch="v4"` to `version="^4"` on release
      import = "astronvim.plugins",
      opts = { -- AstroNvim options must be set here with the `import` key
        mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up
        maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up
        icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available)
        pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override
      },
    },
    { import = "plugins" },
  } --[[@as LazySpec]], {
    -- Configure any other `lazy.nvim` configuration options here
    install = { colorscheme = { "catppuccin", "astrodark", "habamax" } },
    ui = { backdrop = 100 },
    performance = {
      rtp = {
        -- disable some rtp plugins, add more to your liking
        disabled_plugins = {
          "2html_plugin",
          "bugreport",
          "compiler",
          "ftplugin",
          "getscript",
          "getscriptPlugin",
          "gzip",
          "logipat",
          "matchit",
          "netrw",
          "netrwFileHandlers",
          "netrwPlugin",
          "netrwSettings",
          "optwin",
          "rplugin",
          "rrhelper",
          "spellfile_plugin",
          "synmenu",
          "syntax",
          "tar",
          "tarPlugin",
          "tohtml",
          "tutor",
          "vimball",
          "vimballPlugin",
          "zip",
          "zipPlugin",
        },
      },
    },
  } --[[@as LazyConfig]])
end
